import { COLUMN_WIDTH, createCommonPage } from '@/utils/service.js'
import { dateFormat } from '@/utils/date'

/* export const createForm = () => ({
  ...createCommonPage(),
})
 */

export const createColumns = (vm) => [
  {
    title: '序号',
    key: 'id',
    align: 'center',
    width: 80,
    render(h, params) {
      return <div>{(vm.formData.pageNo - 1) * vm.formData.pageSize + params.index + 1}</div>
    },
  },
  {
    title: '稿件标题',
    align: 'center',
    width: COLUMN_WIDTH + 300,
    render(h, params) {
      return <article-title info={params.row}></article-title>
    },
  },
  { title: '供稿单位', key: 'organ', align: 'center' },
  {
    title: '上传时间',
    align: 'center',
    sortable: 'custom',
    sortType: 'desc',
    render(h, params) {
      return <div>{dateFormat(params.row.createTime || '', 'YYYY.MM.DD hh:mm:ss')}</div>
    },
  },
  {
    title: '操作',
    align: 'center',
    render(h, params) {
      {
        /* <div>
          <icon-button
            icon="edit"
            title="编辑"
            activated={true}
            nativeOnClick={() => {
              vm.handleAduit(params.row)
            }}
          ></icon-button>
        </div> */
      }
      return (
        <a
          class="a-normalize"
          onClick={(e) => {
            e.preventDefault()
            vm.handleFeatManu(params.row)
          }}
        >
          取稿
        </a>
      )
    },
  },
]
